/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package diningphilosopher;

/**
 *
 * @author TQNINH
 */
public class Dining {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        ChopStick[] chopsticks = new ChopStick[5];
        
        Philosopher[] philos = new Philosopher[5];
        
        for(int count = 0;count <= 4;count++){
            chopsticks[count] = new ChopStick();
        }
        
        for(int count = 0;count <= 4;count++){
            philos[count] = new Philosopher(count, chopsticks[count],
                    chopsticks[(count+1)%5]);
        }
        
        for(int count = 0;count <= 4;count++){
            philos[count].start();
        }
    }
}
